An important additional part of the process is that before the ROM routine is called, important data is stored in specific places, and this data is later used by the ROM routine in accomplishing its task. Some system extensions work their magic by changing this data before the ROM routine sees it.
Some of this data is held within the microprocessor in small storage areas called registers. Some of it is kept in a data structure called the “Stack.” Still other data is kept in Low Memory Globals.